package cn.chinaunicom.sdsi.upfc_demp.jyxx.controller;

import cn.chinaunicom.sdsi.upfc_demp.demo.entity.UpfDemoTest;
import cn.chinaunicom.sdsi.upfc_demp.demo.service.UpfDemoTestService;
import cn.chinaunicom.sdsi.upfc_demp.jyxx.entity.JyXx;
import cn.chinaunicom.sdsi.upfc_demp.jyxx.service.JyXxService;
import cn.chinaunicom.sdsi.frm.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.authz.annotation.RequiresPermissions;

import net.sf.json.JSONObject;

/**
 * @author lij
 * 2017-5-3 11:21:59
 *
 */

@Controller
@RequestMapping("jyxxController")
public class JyXxController extends BaseController{

	private final Log log = LogFactory.getLog(JyXxController.class);
	
	@Autowired
	private JyXxService jyXxService;

	/**
	 * 跳转至查询页面
	 */
	@RequestMapping("/jyxxInfo")
	public ModelAndView upfDemoTestControllerMain(ModelAndView mv,HttpServletRequest request){
		log.debug("jyxxController.jyxxInfo{}");
		String staffId = request.getParameter("staffId");
        JyXx jyxx = new JyXx();
        jyxx.setStaffId(Integer.parseInt(staffId));
        JyXx bean=jyXxService.selectByPrimaryKey(jyxx);
        mv.addObject("bean", bean);
		mv.setViewName("frm/jyxxcx/jyInfo");
		return mv;
	}
	@ResponseBody
    @RequestMapping("/testTM")
    public int testTM(Map<String, Object> map,HttpServletRequest request,
            Integer start,Integer length){
        String staffId = request.getParameter("staff_id");
        JyXx jyxx = new JyXx();
        jyxx.setStaffId(Integer.parseInt(staffId));
        //JyXx bean=jyXxService.selectByPrimaryKey(jyxx);
        return jyXxService.deleteByPrimaryKey(jyxx);
    }
	
}